home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 2001 January / CT_SW0101.ISO / pc / software / office / datenbk / valentin.sit / Valentina_PPC / more examples / Example for OpenForm / VSearch < prev    next >
Text File  |  1999-09-08  |  1KB  |  30 lines

  1. set HTMLThanksHeader to "<html><head><title>Result page</title></head><body><br>"
  2. set HTMLErrorHeader to "<html><head><title>Error</title></head><body><br>"
  3. set HTMLfooter to "<br><br><br><hr></body></html>"
  4.  
  5. set FormatStr to "<BR><B>Name: </B>%<BR> <B>Company: </B>%<BR><B>E-mail: </B>%<BR><B>Comment: </B>%<BR><BR><HR>"
  6.  
  7.  
  8. try
  9.     tell application "Valentina (PPC)"
  10.         set theFile to choose file with prompt "Choose database file" of type {"Vdsc"}
  11.         set DB to open theFile
  12.         
  13.         tell base object "Guests" of DB
  14.             set ResultSet to select records where {field "Name", "aaa"}
  15.             set theCount to count of records in ResultSet
  16.             
  17.             set result to format data {field "Name", field "Company", field "Email", field "Comment"} from 1 to theCount selection ResultSet using FormatStr
  18.             set result to format data {field "Letter"} from 1 to 1 selection ResultSet using "%" with text to HTML
  19.         end tell
  20.     end tell
  21.     
  22.     
  23.     
  24.     return HTMLThanksHeader & "<H2>Search result:</H2><P> " & result & " <HR><HR>" & HTMLfooter
  25.     
  26.     
  27.     -- if there is an error, notify the user    
  28. on error
  29.     return HTMLErrorHeader & "<H2>Error processing this script</H2>" & HTMLfooter
  30. end try